package com.ruoyi.basebill.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.basebill.domain.WfzWebservice;
import com.ruoyi.basebill.service.IWfzWebserviceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 接口配置Controller
 * 
 * @author ruoyi
 * @date 2023-01-03
 */
@RestController
@RequestMapping("/basebill/webservice")
public class WfzWebserviceController extends BaseController
{
    @Autowired
    private IWfzWebserviceService wfzWebserviceService;

    /**
     * 查询接口配置列表
     */
    @PreAuthorize("@ss.hasPermi('basebill:webservice:list')")
    @GetMapping("/list")
    public TableDataInfo list(WfzWebservice wfzWebservice)
    {
        startPage();
        List<WfzWebservice> list = wfzWebserviceService.selectWfzWebserviceList(wfzWebservice);
        return getDataTable(list);
    }

    /**
     * 导出接口配置列表
     */
    @PreAuthorize("@ss.hasPermi('basebill:webservice:export')")
    @Log(title = "接口配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WfzWebservice wfzWebservice)
    {
        List<WfzWebservice> list = wfzWebserviceService.selectWfzWebserviceList(wfzWebservice);
        ExcelUtil<WfzWebservice> util = new ExcelUtil<WfzWebservice>(WfzWebservice.class);
        util.exportExcel(response, list, "接口配置数据");
    }

    /**
     * 获取接口配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('basebill:webservice:query')")
    @GetMapping(value = "/{fid}")
    public AjaxResult getInfo(@PathVariable("fid") Long fid)
    {
        return success(wfzWebserviceService.selectWfzWebserviceByFid(fid));
    }

    /**
     * 新增接口配置
     */
    @PreAuthorize("@ss.hasPermi('basebill:webservice:add')")
    @Log(title = "接口配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WfzWebservice wfzWebservice)
    {
        return toAjax(wfzWebserviceService.insertWfzWebservice(wfzWebservice));
    }

    /**
     * 修改接口配置
     */
    @PreAuthorize("@ss.hasPermi('basebill:webservice:edit')")
    @Log(title = "接口配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WfzWebservice wfzWebservice)
    {
        return toAjax(wfzWebserviceService.updateWfzWebservice(wfzWebservice));
    }

    /**
     * 删除接口配置
     */
    @PreAuthorize("@ss.hasPermi('basebill:webservice:remove')")
    @Log(title = "接口配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{fids}")
    public AjaxResult remove(@PathVariable Long[] fids)
    {
        return toAjax(wfzWebserviceService.deleteWfzWebserviceByFids(fids));
    }
}
